import request from '@/utils/request'

/**
 * 分页获取权限
 */
export function getPermissionPage(params, pageNum, pageSize, token) {
  return request({
    url: '/permission/list/page',
    method: 'get',
    params: {
      ...params,
      pageNum,
      pageSize
    },
    headers: {
        'token': token
    }
  })
}


/**
 * 获取权限详情
 */
export function getPermissionDetail(id, token) {
  return request({
    url: '/permission/getPermissionDetail/' + id,
    method: 'get',
    headers: {
        'token': token
    }
  })
}

/**
 * 保存权限
 */
export function savePermission(data, token) {
  return request({
    url: '/permission/addOrUpdate',
    method: 'post',
    params: {
        ...data
    },
    headers: {
        'token': token
    }
  })
}


/**
 * 删除权限
 */
export function deletePermission(id, token) {
  return request({
    url: '/permission/delPermissionById/' + id,
    method: 'post',
    headers: {
        'token': token
    }
  })
}
